home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / tphers01.zip / DRAWBOX.PAS < prev    next >
Pascal/Delphi Source File  |  1991-09-08  |  2KB  |  51 lines

  1. {*****************************************************************************}
  2. {*  This program displays characters inside their character box.             *}
  3. {*  It demonstrates how small portion of the character box which is          *}
  4. {*  filled up by the character. It is the percentage of the character        *}
  5. {*  box as regards to the Maximal x coordinates which is used to set the     *}
  6. {*  character size.                                                          *}
  7. {*                                                                           *}
  8. {*  This code is donated to the Public domain.                               *}
  9. {*                                                                           *}
  10. {*  Dov Grobgeld                                                             *}
  11. {*  Department of Chemical Physics                                           *}
  12. {*  The Weizmann Institute of Science                                        *}
  13. {*  Israel                                                                   *}
  14. {*  Email: dov@menora.weizmann.ac.il                                         *}
  15. {*                                                                           *}
  16. {*  8/9/1991                                                                 *}
  17. {*****************************************************************************}
  18. uses Graph, Dos, TPHersh;
  19.  
  20. var
  21.   gd, gm : integer;
  22.   mem: longint;
  23.   symNum : integer;
  24.  
  25. begin
  26.   mem:= MaxAvail;
  27.   HersheyLoadGlyphs;
  28.   writeln('Font load size: ', mem - MaxAvail);
  29.   write('Press Enter to continue...'); readln;
  30.  
  31.   gd:= detect;
  32.   initgraph(gd, gm, getenv('bgidir')); { Set the environment variable bgi dir }
  33.                                        { to the directory where the bgi files reside }
  34.   HersheySetGlyphSize(40,40);
  35.   symNum:=501;
  36.   repeat
  37.     clearviewport;
  38.     HersheyMove(200, 200);
  39.     rectangle(round(HersheyX - 0.40*HersheyMaxX/2),
  40.               round(HersheyY - 0.40*HersheyMaxX/2),
  41.               round(HersheyX + 0.40*HersheyMaxX/2),
  42.               round(HersheyY + 0.40*HersheyMaxX/2));
  43.     HersheyMove(round(200- HersheyGlyphWidth(symNum)/2),200);
  44.     setcolor(white);
  45.     HersheyDisplayGlyph(symNum);
  46.     readln(symNum);
  47.   until symNum=0;
  48.   closegraph;
  49. end.
  50.  
  51.